unit USplitFormTemplate;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls,
  Vcl.Imaging.pngimage, Vcl.Styles, Vcl.Themes, System.Actions, Vcl.ActnList,
  Vcl.Touch.GestureMgr, AdvAppStyler, dxGDIPlusClasses, AdvMetroButton,
  Vcl.ButtonGroup;

type
  TDetailForm = class(TForm)
    UpperPanel: TPanel;
    TitleLabel: TLabel;
    Image1: TImage;
    ScrollBox1: TScrollBox;
    GridPanel1: TGridPanel;
    GridPanel2: TGridPanel;
    ItemTitle1: TLabel;
    GridPanel3: TGridPanel;
    ItemTitle2: TLabel;
    ItemSubTitle2: TLabel;
    ItemDescription2: TLabel;
    ItemImage3: TImage;
    GridPanel4: TGridPanel;
    ItemTitle3: TLabel;
    ItemSubTitle3: TLabel;
    ItemDescription3: TLabel;
    ItemImage1: TImage;
    ItemImage2: TImage;
    ScrollBox2: TScrollBox;
    GestureManager1: TGestureManager;
    ActionList1: TActionList;
    Action1: TAction;
    AppBar: TPanel;
    CloseButton: TImage;
    LowerPanel: TPanel;
    ButtonGroup1: TButtonGroup;
    Panel1: TPanel;
    procedure BackToMainForm(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Action1Execute(Sender: TObject);
    procedure FormResize(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure FormGesture(Sender: TObject; const EventInfo: TGestureEventInfo;
      var Handled: Boolean);
  private
    { Private declarations }
    procedure AppBarResize;
    procedure AppBarShow(mode: integer);

    procedure HandleClick();
  public
    { Public declarations }
  end;

var
  DetailForm: TDetailForm = nil;

implementation

{$R *.dfm}


const
  AppBarHeight = 75;

procedure TDetailForm.AppBarResize;
begin
  AppBar.SetBounds(0, AppBar.Parent.Height - AppBarHeight,
    AppBar.Parent.Width, AppBarHeight);
end;

procedure TDetailForm.AppBarShow(mode: integer);
begin
  if mode = -1 then // Toggle
    mode := integer(not AppBar.Visible );

  if mode = 0 then
    AppBar.Visible := False
  else
  begin
    AppBar.Visible := True;
    AppBar.BringToFront;
  end;
end;

procedure TDetailForm.HandleClick;
begin

end;

procedure TDetailForm.Action1Execute(Sender: TObject);
begin
  AppBarShow(-1);
end;

procedure TDetailForm.FormCreate(Sender: TObject);
var
  LStyle: TCustomStyleServices;
begin
  //Set background color for memos to the color of the form, from the active style.
  LStyle := TStyleManager.ActiveStyle;

end;

procedure TDetailForm.FormGesture(Sender: TObject;
  const EventInfo: TGestureEventInfo; var Handled: Boolean);
begin
  AppBarShow(0);
end;

procedure TDetailForm.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = VK_ESCAPE then
    AppBarShow(-1)
  else
    AppBarShow(0);
end;

procedure TDetailForm.FormResize(Sender: TObject);
begin
  AppBarResize;
end;

procedure TDetailForm.FormShow(Sender: TObject);
var
  GroupElements: TStringList;
  memoStr: String;
begin

end;

procedure TDetailForm.BackToMainForm(Sender: TObject);
begin
  Hide;

end;

end.
